package com.dream.service.user.dao;

import com.dream.service.user.domain.model.UserModel;
import com.dream.service.user.domain.request.UserCondition;
import com.dream.service.user.domain.request.UserSelectCondition;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by kangd on 2016/4/5.
 */
public interface UserDao {

    /**
     *注册用户，增加新用户
     * @param userModel
     * @return
     * @throws Exception
     */
    public int addUser(UserModel userModel)  throws Exception;

    /**
     * 根据pin查询
     * @param pin
     * @return
     * @throws Exception
     */
    public UserModel selectByPIN(String pin)  throws Exception;

    /**
     * 根据email查询
     * @param login_email
     * @return
     * @throws Exception
     */
    public UserModel selectByEmail(@Param("login_email")String login_email,@Param("login_type")Integer login_type)  throws Exception;


    /**
     * 登录验证密码
     * @param login_email
     * @param pwd
     * @param login_type
     * @return
     * @throws Exception
     */

    public UserModel selectCheckPW(@Param("login_email")String login_email,@Param("pin")String pin, @Param("pwd")String pwd,@Param("login_type")Integer login_type) throws  Exception;


    /**
     * 更新用户信息
     * @param userModel
     * @return
     * @throws Exception
     */
    public int updateUser(UserModel userModel) throws  Exception;


    /**
     * 查询用户
     * @return
     * @throws Exception
     */
    public List<UserModel> selectBySelective(UserSelectCondition userSelectCondition) throws Exception;


    //查询用户 数量
    public int selectCountBySelective(UserSelectCondition userSelectCondition) throws Exception;


/*

    public UserTestModel selectByPINTest(String pin)  throws Exception;

    public int addUserTest(UserTestModel userTestModel)  throws Exception;

    public int updateUserTest (UserTestModel userTestModel) throws  Exception;*/

    /**
     * 根据userId查询用户信息
     * @param userId
     * @return
     * @throws Exception
     */
    public UserModel selectByUserId(int userId)  throws Exception;


    /**
     * 第三方登录查询邮箱
     * @param third_id
     * @param login_type
     * @return
     * @throws Exception
     */
    public String selectEmailByThirdLoginID(@Param("third_id")String third_id,@Param("login_type")int login_type)  throws Exception;

    /**
     * 根据用户登录邮箱或者id来查询用户信息
     * @param model
     * @return
     */
    public List<UserModel> selectByEmailOrId(UserModel model);

    public int updateUserNetRed(UserModel model);

    /**
     * 根据条件查询
     * @param userCondition
     * @return
     */
    public List<UserModel> queryByCondition(UserCondition userCondition);

    /**
     * 总量
     * @param userCondition
     * @return
     */
    Integer queryCountByCondition(UserCondition userCondition);
}
